<div class="table-top">
  <div class="table-operations clearfix ">
    <div class="pull-right">
      <div class="log-right">
        <nz-range-picker style="margin-right: 0!important;"
          class="picler-top"
          [nzDisabledDate]="disabledDate"
          [(ngModel)]="time"
          (ngModelChange)="timeChange()"
          nzShowTime
          [nzFormat]="dateFormat"
          (nzOnOk)="changeDate()"
          [nzPlaceHolder]="['开始时间', '结束时间']"
        ></nz-range-picker>

        <!-- <nz-input-group nzSearch [nzAddOnAfter]="suffixIconButton">
          <input type="text"
                 nzSize="large"
                 nz-input
                 placeholder="请输入日志请求的requestID"
                 [(ngModel)]="requestId"
                 (keyup.enter)="getLogList()">
        </nz-input-group>
        <ng-template #suffixIconButton>
          <button class="search-btn" nz-button nzSearch (click)="searchLogList()">
            <i class="anticon anticon-search search-icon"></i>
          </button>
        </ng-template> -->

        <nz-input-group nzSearch [nzSuffix]="suffixIconButton" style="width: 2rem;margin-right: 0.08rem;">
          <input type="text" [(ngModel)]="requestId" nz-input placeholder="请输入requestID查询" (keyup.enter)="getLogList()">
        </nz-input-group>
        <ng-template #suffixIconButton>
          <i nz-icon class="ant-input-clear-icon" nzTheme="fill" nzType="close-circle" *ngIf="requestId" (click)="requestId = '';getLogList()"></i>
          <button nz-button nzSearch (click)="getLogList()">
            <i class="anticon anticon-search"></i>
          </button>
        </ng-template>


        <button nz-button nz-popover [nzContent]="'刷新'" (click)="refresh()" ><i class="anticon anticon-reload"></i></button>
      </div>
    </div>
  </div>
</div>
<nz-table #nzTable [nzData]="logList" [(nzPageSize)]="pageSize" [(nzPageIndex)]="pageNo" nzShowSizeChanger
    [nzTotal]="totalCount" [nzShowTotal]="rangeTemplate" [nzLoading]="isLogLoading" 
    [nzFrontPagination]="false" (nzPageIndexChange)="getLogList()" (nzPageSizeChange)="getLogList()"
    class="table-fixed" [nzNoResult]="noResult"
    [nzHideOnSinglePage]="totalCount <= 10" [nzShowQuickJumper]="true" [nzShowSizeChanger]="true" style="margin-bottom: 20px;">
  <thead>
    <tr>
      <th nzWidth="0.35rem" nzShowExpand></th>
      <th nzWidth="2.8rem">requestID</th>
      <th nzWidth="1.5rem" nzShowRowSelection [nzSelections]="listOfSelection">调用状态</th>
      <th>触发类型</th>
      <th>执行时间</th>
      <th>运行内存</th>
      <th nzWidth="1.6rem">调用时间</th>
    </tr>
  </thead>
  <tbody>
    <ng-template ngFor let-data [ngForOf]="nzTable.data">
      <tr>
        <td nzShowExpand [(nzExpand)]="data.expand"></td>
        <td>{{data.requestId || '--'}}</td>
        <td [innerHtml]="data.returnCode | status: 'invoke-status' | async"></td>
        <td>{{data.invokeTypeString || '--'}}</td>
        <td>{{data.runtimeDuration}}ms</td>
        <td>{{data.memoryUsage}}MB</td>
        <td>{{(data.startTime | date: 'yyyy-MM-dd HH:mm:ss') || '--'}}</td>
      </tr>
      <tr [nzExpand]="data.expand">
        <td colspan="7" class="expand-td-background">
          <div class="form-fieldset expand-fieldset">
            <fieldset>
              <legend>
                  执行结果
              </legend>
              <pre><code>{{data.returnMsg || '--'}}</code></pre>
            </fieldset>
          </div>
          <div class="form-fieldset" style="border: none;">
            <fieldset>
              <legend>
                  执行日志
              </legend>
                <pre><code>{{data.log || '--'}}</code></pre>
            </fieldset>
          </div>
        </td>
      </tr>
    </ng-template>
  </tbody>
  <ng-template #noResult>
    <table-no-result-search></table-no-result-search>
  </ng-template>
  <ng-template #rangeTemplate let-range="range" let-total>
    共{{total}}条
  </ng-template>
</nz-table>
